<?php
namespace app\ice\model;
use app\common\logic\FlashSaleLogic;
use app\common\logic\GroupBuyLogic;
use think\Model;
class Notify extends Model {
    protected $table = 'ig_notify';
    //自定义初始化
    protected static function init()
    {
        //TODO:自定义的初始化
    }
    public function promGoods()
    {
        return $this->hasOne('PromGoods', 'id', 'prom_id')->cache(true,10);
    }

    public function goods()
    {
        return $this->hasOne('Goods', 'goods_id', 'goods_id')->cache(true,10);
    }
    public function getNotifyInfo($id){
    	$res = $this->where('order_id',$id)->find();
        return $res;
    }


    public function addNotifyInfo($data,$order_id){
		$datas->order_id = $order_id;
        $datas->total_fee = $data['total_fee'];
		$datas->out_trade_no = $data['out_trade_no'];
        $datas->transaction_id = $data['transaction_id'];
        $datas->time_end = strtotime($data['time_end']);
        $datas->trade_type = $data['trade_type'];
		$result = $this->save($datas);
	return true;
}